#!/bin/bash
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

if [ -x /etc/icpc/doclean.sh ]; then
  /etc/icpc/doclean.sh
fi

grep -iq "iface.*eth0" /etc/network/interfaces
if [ $? != 0 ]; then
  echo "auto eth0" >> /etc/network/interfaces
  echo "iface eth0 inet dhcp" >> /etc/network/interfaces
fi

grep -q "143.107.255.15.*ntp.usp.br.*ntp.usp.br" /etc/hosts
if [ $? != 0 ]; then
  echo "143.107.255.15 ntp.usp.br ntp.usp.br" >> /etc/hosts
fi 
grep -q "143.107.45.22.*www.ime.usp.br.*www.ime.usp.br" /etc/hosts
if [ $? != 0 ]; then
  echo "143.107.45.22 www.ime.usp.br www.ime.usp.br" >> /etc/hosts
fi 
ntpdate -u ntp.usp.br
ntpdate -u ntp.usp.br
exit 0
